from decorators.devtools import rangetest

print(__debug__)


@rangetest(age=(0, 120))
def persinfo(name, age):
    # print('Ok')
    return print('%s is %s years old' % (name, age))


@rangetest(M=(1, 12), D=(1, 31), Y=(0, 2009))
def birthday(M, D, Y):
    print('birthday = {0} / {1} / {2}'.format(D, M, Y))


@rangetest(a=(1, 10), b=(1, 10), c=(1, 10), d=(1, 10))
def omitargs(a, b=7, c=8, d=9):
    print(a, b, c, d)


class Person:
    def __init__(self, name, job, pay):
        self.name = name
        self.job = job
        self.pay = pay

    @rangetest(percent=(0.0, 1.0))
    def giveRaise(self, percent):
        self.pay = int(self.pay * (1 + percent))


if __name__ == '__main__':
    bob = Person('Bob Smith', 'dev', 100000)
    sue = Person('Sue Jones', 'dev', 100000)
    bob.giveRaise(.10)
    sue.giveRaise(percent=.20)
    print(bob.pay, sue.pay)
    omitargs(1, 2, 3, 4)
    omitargs(1, 2, 3)
    omitargs(1, 2, 3, d=4)
    omitargs(1, d=4)
    omitargs(d=4, a=1)
    omitargs(1, b=2, d=4)
    omitargs(d=8, c=7, a=1)
    omitargs(9)
    omitargs(1)
    birthday(1, 10, 2001)
